const connections = require('../app/database')
class UserService {
  async create(userInfo) {
    const { user, password } = userInfo
    const statement = 'INSERT INTO user(user, password) value (?, ?);'
    const result = await connections.execute(statement, [user, password])
    return result[0]
  }
  async getUserByName(user) {
    const statement = 'SELECT * FROM user WHERE user = ?'
    const result = await connections.execute(statement, [user])
    return result[0]
  }
}

module.exports = new UserService()